<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3_自定义过滤器</title>
    <script src="../lib/angularjs.js"></script>
</head>

<body ng-app="myApp" ng-controller="myCtrl">
    {{msg | reverse}}
</body>
<script>
    const myApp = angular.module("myApp", [])
    myApp.controller("myCtrl", ["$scope", function ($scope) {
        $scope.msg = "Runoob";
    }])
    // 自定义过滤器
    myApp.filter("reverse", function () {
        return function (text) { 
            return text.split("").reverse().join("")
        }
    })
</script>

</html>